package team.kirohuji.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import team.kirohuji.dao.AttendanceRecordDao;
import team.kirohuji.domain.AttendanceRecord;
import team.kirohuji.service.AttendanceRecordService;

/**
* 
* what
* 
* @author kirohuji
* @version 0.1
*/
@Service("afficheRecordService")
public class AttendanceRecordServiceImpl implements AttendanceRecordService {
	@Resource
	private AttendanceRecordDao attendanceRecordDao;
	@Override
	public AttendanceRecord queryObject(Integer attendanceRecordId) {
		return attendanceRecordDao.queryObject(attendanceRecordId);
	}

	@Override
	public List<AttendanceRecord> queryList(Map<String, Object> map) {
		return attendanceRecordDao.queryList(map);
	}

	@Override
	public int queryTotal(Map<String, Object> map) {
		return attendanceRecordDao.queryTotal(map);
	}

	@Override
	public void save(AttendanceRecord attendanceRecord) throws IllegalArgumentException {
		attendanceRecordDao.save(attendanceRecord);
	}

	@Override
	public void update(AttendanceRecord attendanceRecord) throws IllegalArgumentException {
		attendanceRecordDao.update(attendanceRecord);
		
	}

	@Override
	public void deleteBatch(Integer[] ids) {
		attendanceRecordDao.deleteBatch(ids);
	}

	@Override
	public void saveOrUpdate(AttendanceRecord record) {
		if(queryObjectByUserId(record.getAttendanceRecordId())!=null) {
			attendanceRecordDao.save(record);
		}else {
			attendanceRecordDao.update(record);
		}
		
	}

	@Override
	public AttendanceRecord queryObjectByUserId(Integer systemUserId) {
		// TODO Auto-generated method stub
		return attendanceRecordDao.queryObject(systemUserId);
	}

}
